home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 05.zip
/
BS1 part 5
/
PDraw3.0.adf
/
pdraw_rex.lzh
/
_PD_TOOLS_RECT.pdrx
< prev
next >
Wrap
Text File
|
1992-06-15
|
2KB
|
99 lines
/*
RECTANGLE TOOL
Modifiers:
ALT will constrain the rectangle to a square
Double Clicking will bring up a requester which allows you to set
the dimensions and radius of curvature of the rectangle
*/
msg = PDSetup.rexx(2,0)
units = getclip(pds_units)
if msg ~= 1 then exit_msg(msg)
magic = 0.55228479
cr = '0a'x
width = getclip(pduserrectwidth)
height = getclip(pduserrectheight)
radius = getclip(pduserrectradius)
if units > 2 then
do
width = pdm_ConvertUnits(1,units, width)
height = pdm_ConvertUnits(1,units, height)
radius = pdm_ConvertUnits(1,units, radius)
end
size = pdm_GetForm("Enter size of Rect", 8, "Width:"width || cr"Height:"height ||cr"radius:"radius)
if size = '' then exit_msg()
parse var size width '0a'x height '0a'x radius
if radius = '' then radius = 0
if ~(datatype(width, n) & datatype(height,n) & datatype(radius,n)) then
exit_msg("Invalid Entry")
if width <= 0 | height <= 0 then
exit_msg("Invalid Entry")
if units > 2 then
do
width = pdm_ConvertUnits(units,1, width)
height = pdm_ConvertUnits(units,1, height)
radius = pdm_ConvertUnits(units,1, radius)
end
call setclip(pduserrectwidth, width)
call setclip(pduserrectheight, height)
call setclip(pduserrectradius, radius)
rect = pdm_ClickRectangle("Click", width, height)
if rect = '' then exit_msg()
left = word(rect, 1) - (width / 2)
top = word(rect, 2) - (height / 2)
right = left + width
bottom = top + height
if radius = 0 then
call pdm_DrawRectangle(left, top, right, bottom)
else
do
call pdm_InitPlot()
lxpos = left + radius
rxpos = right - radius
typos = top + radius
bypos = bottom - radius
radlen = radius * magic
nradlen = -radlen
call pdm_PlotBezier(lxpos" "top" "nradlen" 0 0 0")
call pdm_PlotBezier(rxpos" "top" 0 0 "radlen" 0")
call pdm_PlotBezier(right" "typos" 0 "nradlen" 0 0")
call pdm_PlotBezier(right" "bypos" 0 0 0 "radlen)
call pdm_PlotBezier(rxpos" "bottom" "radlen" 0 0 0")
call pdm_PlotBezier(lxpos" "bottom" 0 0 "nradlen" 0")
call pdm_PlotBezier(left" "bypos" 0 "radlen" 0 0")
call pdm_PlotBezier(left" "typos" 0 0 0 "nradlen)
call pdm_PlotBezier(lxpos" "top" "nradlen" 0 0 0")
call pdm_ClosePlot()
end
exit_msg()
exit_msg: procedure expose units
do
parse arg message
if message ~= '' then call pdm_Inform(1,message,)
call pdm_SetUnits(units)
call pdm_AutoUpdate(1)
exit
end